package com.scs.application.modules.msg.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.scs.application.core.service.BaseServiceImpl;
import com.scs.application.core.utils.UserUtils;
import com.scs.application.modules.cfg.utils.ParameterUtils;
import com.scs.application.modules.msg.entity.InnerInbox;
import com.scs.application.modules.msg.mapper.InnerInboxMapper;
import com.scs.application.modules.msg.service.InnerInboxService;
import com.scs.application.modules.msg.vo.InnerInboxVO;
import org.springframework.stereotype.Service;


@Service
public class InnerInboxServiceImpl extends BaseServiceImpl<InnerInboxMapper, InnerInbox> implements InnerInboxService {



    @Override
    public IPage<InnerInboxVO> pageByUser(IPage page, QueryWrapper queryWrapper) {
        return this.baseMapper.page(page, queryWrapper);

    }

    @Override
    public InnerInboxVO findInnerInboxById(String id) {
        return this.baseMapper.findInnerInboxById(id);
    }

    @Override
    public int countNews() {
        return this.baseMapper.countNews(UserUtils.currentUser().getCode());
    }

    @Override
    public InnerInboxVO msgUserTop1() {
        return this.baseMapper.msgUserTop1(UserUtils.currentUser().getCode());
    }

    @Override
    public InnerInboxVO getMsgByNoticeId(String noticeId) {
        return this.baseMapper.getMsgByNoticeId(noticeId, UserUtils.currentUser().getCode());
    }

    @Override
    public void autoRead() {
        Integer autoReadTime = ParameterUtils.getMsgAutoReadTime();
        this.baseMapper.autoRead(autoReadTime);
    }

}
